import {reqCategoryList,reqBannerList,reqFloorList} from '@/api'
const state ={
    categoryList:[],
    bannerList:[],
    floorList:[]
}
const mutations={
    //三级分类列表
    GETCATEGORYLIST(state,categoryList){
        state.categoryList=categoryList
    },
    //ListContainer轮播图
    GETBANNERLIST(state,bannerList){
        state.bannerList=bannerList
    },
    //Floor轮播图
    GETFLOORLIST(state,floorList){
        state.floorList=floorList
    }
}
const actions ={
    //获取三级列表
    async getCategorylist({commit}){
        const result =await reqCategoryList()
        if(result.code === 200){
        commit('GETCATEGORYLIST',result.data)
        }
    },
    //获取bannerList
    async getBannerList({commit}){
        const result = await reqBannerList()
        if(result.code===200){
            commit('GETBANNERLIST',result.data)
        }
    },
    //获取floorList
    async getFloorList({commit}){
        const result = await reqFloorList()
        if(result.code===200){
            commit('GETFLOORLIST',result.data)
        }
    }
}
const getters ={

}

export default {
    state,
    mutations,
    actions,
    getters,
}